﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace yd.ControllerBase
{
    public class UserRightAttribute : ActionFilterAttribute
    {
        public string RightCode { get; set; }


        public UserRightAttribute(string _rightCode="")
        {
            RightCode = _rightCode;
        }
        /// <summary>
        /// 進入 Action 的時候執行
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
           
            //設定完畢後將他利用 ViewData 傳到 Action 內
            filterContext.Controller.ViewData["Exclude"] = RightCode;
        }
    }
}